<template>
    <div class="login-wrap">
        <!-- body -->
        <p @click="dumpUrl">测试</p>
    </div>
</template>

<script>
    export default {
        data: function(){
            return {
                ruleForm: {
                    username: '',
                    password: ''
                },
                rules: {
                    username: [
                        { required: true, message: '请输入用户名', trigger: 'blur' },
                        { pattern: /^admin\n?$/, message: '请输入正确管理员账号' }
                    ],
                    password: [
                        { required: true, message: '请输入密码', trigger: 'blur' },
                        { pattern: /^123456\n?$/, message: '请输入正确管理员密码' }
                    ]
                }
            }
        },
        methods: {
            dumpUrl () {
                this.$router.push('/selectsub');
            },
            submitForm(formName) {
                const self = this;
                self.$refs[formName].validate((valid) => {
                    if (valid) {
                        if (self.ruleForm.username === 'admin' && self.ruleForm.password === '123456') {
                            localStorage.setItem('ms_username',self.ruleForm.username);
                            self.$router.push('/baseform');
                        } else {
                            console.log('error submit!!');
                            return false;
                        }
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            }
        }
    }
</script>

<style scoped>
    .login-wrap{
        position: relative;
        width:100%;
        height:100%;
    }
    .ms-title{
        position: absolute;
        top:50%;
        width:100%;
        margin-top: -230px;
        text-align: center;
        font-size:30px;
        color: #fff;

    }
    .ms-login{
        position: absolute;
        left:50%;
        top:50%;
        width:300px;
        height:160px;
        margin:-150px 0 0 -190px;
        padding:40px;
        border-radius: 5px;
        background: #fff;
    }
    .login-btn{
        text-align: center;
    }
    .login-btn button{
        width:100%;
        height:36px;
    }
</style>